package com.koron.sinoprobe.web.ledger.controller;


import com.koron.bean.base.Response;
import com.koron.common.core.config.ThreadLocalContext;
import com.koron.sinoprobe.web.ledger.bean.vo.SpProjectVO;
import com.koron.sinoprobe.web.ledger.service.SpProjectEquipmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.koron.ebs.mybatis.ADOConnection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 项目设备从表(SpProjectEquipment)表控制层
 *
 * @authr jzp
 * @since 2022-06-07 11:55:59
 */
@Api(tags = "专项台账-设备绑定")
@RestController
@RequestMapping("/sp/project/equipment")
public class SpProjectEquipmentController {
    /**
     * 服务对象
     */
    @Autowired
    private SpProjectEquipmentService spProjectEquipmentService;

    private String getCurrDs() {
        return ThreadLocalContext.get().getCurrDs();
    }

    @PostMapping("/save")
    @ApiOperation(value = "批量保存设备信息", notes = "只保存项目里面的设备信息")
    public Response<String> saveOrUpdate(@RequestBody SpProjectVO spProjectVO) {
        ADOConnection.runTask(getCurrDs(), spProjectEquipmentService, "saveOrUpdateBatch", Boolean.class, spProjectVO);
        return Response.ok("操作成功", null);
    }

}
